home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
8_13.lha
/
8_13
/
tst13.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
648b
|
34 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <pat.h>
ain()
pat p(cin);
int x, y;
float f;
if (p.match("%d %f %d")) {
cout << "match 1 %d %f %d succeeded\n";
p >> x >> f >> y;
} else if (p.match("%f %d %d")) {
cout << "match 2 %f %d %d succeeded\n";
p >> f >> x >> y;
} else {
cout << "default succeeded\n";
p >> x >> y >> f;
}
cout << "x = " << x << "\n"
<< "y = " << y << "\n"
<< "f = " << f << "\n";
int a = -1, b = -2;
p >> a >> b;
cout << "a = " << a << "\n"
<< "b = " << b << "\n";
return 0;